import request from "@/util/http";
import qs from "qs";

export default {
  //渲染页面接口
  gain(forms) {
    return request({
      method: "get",
      params: {
        _gp: "admin.advertisement",
        _mt: "queryAdvertisement" ,
        adType: forms.adType,//广告类型
        pageNo: forms.pageNo,//页码
        limit: forms.limit,//页码长度
        status:forms.status//广告状态
      }
    });
  },
  //新增管理员
  adduser(form) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.advertisement",
        _mt: "addAdvertisement",
        adType:form.adType,
        title:form.title,
        url :form.url,
        imgUrl :form.imgUrl,
        status :form.status,
        color :form.color
      })
    });
  },
  //删除接口
  cancel(form) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.advertisement",
        _mt: "deleteAdvertisement",
        adType:form.adType,
        adId:form.id
      })
    });
  },
  //编辑角色
  compile(form) {
    return request({
      method: "post",
      data: qs.stringify({
        _gp: "admin.advertisement",
        _mt: "updateAdvertisement",
        adType:form.adType,
        title:form.title,
        url :form.url,
        imgUrl :form.imgUrl,
        status :form.status,
        color :form.color,
        adId:form.id
      })
    });
  },
  //获取SPU树
  spu() {
    return request({
      method: "get",
      params: {
        _gp: "admin.goods",
        _mt: "getSpuBigTree"
      }
    });
  }
};